--- ltmain.sh.orig	2009-04-18 14:37:16.000000000 +0200
+++ ltmain.sh	2009-04-18 14:40:08.000000000 +0200
@@ -4721,10 +4721,15 @@
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
 	arg=$func_stripname_result
 	;;
 
+      -Wl,--as-needed|-Wl,--no-as-needed)
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
       -Wl,*)
 	func_stripname '-Wl,' '' "$arg"
 	args=$func_stripname_result
 	arg=
 	save_ifs="$IFS"; IFS=','
@@ -5075,10 +5080,19 @@
 
       for deplib in $libs; do
 	lib=
 	found=no
 	case $deplib in
+	-Wl,--as-needed|-Wl,--no-as-needed)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	  fi
+	  continue
+	  ;;
 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
